package io.rehuo.modules.app.controller;

import io.rehuo.common.utils.R;
import io.rehuo.modules.app.annotation.Login;
import io.rehuo.modules.app.entity.SysDictData;
import io.rehuo.modules.app.service.SysDictDataService;
import io.rehuo.modules.app.service.SysDictTypeService;
import io.rehuo.modules.app.service.impl.SysDictDataServiceImpl;
import io.swagger.annotations.*;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author shiguang on 2022/9/13 10:20
 */
@RestController
@RequestMapping("/app/dict")
@Api("数据接口")
public class DictController {

    @Autowired
    private SysDictDataService dictDataService;

    @Login
    @GetMapping("getList")
    @ApiOperation(value = "根据类型获取数据列表", notes = "根据类型获取数据列表")
    @ApiImplicitParam(name = "type", value = "类型", paramType = "query", required = true, dataTypeClass = String.class)
    @ApiResponses({
            @ApiResponse(code = 0, message = "操作成功"),
            @ApiResponse(code = 401, message = "权限错误"),
            @ApiResponse(code = 500, message = "系统错误"),
    })
    public R getList(String type){
        return R.ok().put("list",dictDataService.getList(type));
    }

}
